﻿@model PagedList<ArticleCommentModel>
@using MyBlog

@if (Model.Count == 0)
{
    <div class="dv-none-tip">暂无评论~</div>
}
else
{
    int i = 1;
    foreach (var item in Model)
    {
        var cuser = WebCache.GetAccount(item.CommentUid);
        var j = Model.TotalItemCount + 1 - ((Model.CurrentPageIndex - 1) * 10 + (i++));
        <div class="dv-msg-com-begin">
            <div class="dv-msg-com-main">
                <div class="dv-msg-com-main-header">
                    <a href="@Url.Content("~/" + item.CommentUid)">
                        @if (cuser.HeadId.HasValue && cuser.HeadId.Value > 0)
                        {
                            <img class="imghead75" src="@Url.Action("GetUserHeadByUid","account", new {uid= item.CommentUid })" />
                        }
                        else
                        {
                            <img class="imghead75" src="~/Content/Images/zanwutouxiang.jpg" />
                        }
                    </a>
                </div>
                <div class="dv-msg-com-main-body">
                    <div class="dv-msg-com-main-body-header">
                        <span>
                            <span class="spfloor">#@(j)楼</span>
                            <span class="spuid">@cuser.NickName</span>
                            <span class="sptime">@item.CommentTime.ToString("yyyy-MM-dd HH:mm")</span>
                        </span><br />
                        <span class="spcontent ueditorContent">@Html.Raw(item.Content)</span>
                    </div>
                    <div class="dv-msg-com-main-body-footer">
                        <span>
                            <a href="javascript:;" onclick="replyComment(@item.ID,'@cuser.NickName')"><i class="icon-reply"></i> 回复</a>
                        </span>
                        <span>
                            <a href="javascript:;" onclick="agreeComment(@item.ID,@item.AgreeCount,this)"><i class="icon-heart"></i> 赞(@item.AgreeCount)</a>
                        </span>
                        @if (ViewBag.CanEdit)
                        {
                            <span>
                                <a href="javascript:;" onclick="delComment(@item.ID)"><i class="icon-remove"></i> 删除</a>
                            </span>
                        }
                    </div>
                </div>
            </div>
            @if (item.ArticleCommentModels.Count > 0)
            {
                Html.RenderPartial("_CommentReplyList", new ViewDataDictionary { { "models", item.ArticleCommentModels }, { "count", j }, { "CanEdit",ViewBag.CanEdit} });
            }
        </div>
    }
    if (Model.CurrentPageIndex < Model.TotalPageCount)
    {
        <div class="dv-msg-loadmore">
            <a href="javascript:;" onclick="showmore(this)">加载更多评论</a>
        </div>
    }
    else
    {
        <div class="dv-msg-loadmore">
            没有更多的评论了~
        </div>
    }
    <input type="hidden" id="hidpage" value="@Model.CurrentPageIndex" />
}